package com.uni.service;

import com.uni.dao.UserDao;
import com.uni.dao.UserDaoImpl;
import com.uni.entity.CommodityRecord;
import com.uni.entity.User;

import java.util.List;

/**
 * --------------project-------------
 *
 * @Author Unirithe  - Mr.Chao
 * - CSDN:
 * https://blog.csdn.net/Unirithe
 * - GitHub:
 * https://github.com/unirithe
 * @create 2021/12/18 12:19
 * ------------------------------------------
 */
public class UserServiceImpl implements UserService{
    UserDao userDao = new UserDaoImpl();

    @Override
    public User queryUserByName(String name) {
        return userDao.queryUserByName(name);
    }

    @Override
    public User queryByPhone(String phone) {
        return userDao.queryByPhone(phone);
    }

    @Override
    public boolean registerUser(User user) {
        return userDao.insertUser(user);
    }

    @Override
    public User checkUser(String name, String password) {
        return userDao.checkUser(name, password);
    }

    @Override
    public boolean updateUser(User user) {
        return userDao.updateUSer(user);
    }

    @Override
    public List<User> queryAllUser() {
        return userDao.queryAllUser();
    }

    @Override
    public User queryUserById(int id) {
        return userDao.queryUserById(id);
    }

    @Override
    public List<CommodityRecord> queryHistory(User user) {
        return userDao.queryHistory(user);
    }

    @Override
    public boolean deleteUserById(int id) {
        return userDao.deleteUserById(id);
    }

    @Override
    public boolean deleteHistoryById(int id) {
        return userDao.deleteHistoryById(id);
    }
}
